<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
	<input type="hidden" id="commontype" value="0" /><!-- type -->
    <ul class="nav nav-tabs" id="tabs1" style="width: 96%;">
	</ul> 
<script>
	var typelist = 0;
	<s:hasPermission name="type:8">
		typelist = 8;
	</s:hasPermission>
	<s:hasPermission name="type:7">
		typelist = 7;
	</s:hasPermission>
	<s:hasPermission name="type:6">
		typelist = 6;
	</s:hasPermission>
	$(function(){
		$.ajax({  
	        type: 'POST',  
	        dataType : "json",  
	        url:"<%=contextPath %>/putInto/getDataByType?type=sys_modular", 
	        error: function () {//请求失败处理函数  
	            alert('请求失败');  
	        },  
	        success:function(data){ //请求成功后处理函数。
	        	$.each(data,function(index,item){
	        		if(item.id==6){
	        			$("#tabs1").append("<s:hasPermission name="type:6"><li><input type='hidden' name='ss12' value='"+item.id+"' /><a data-toggle='tab' aria-expanded='true' onclick='tabs(this)' >"+item.valueName+"</a></li></s:hasPermission>");
	        		}else if(item.id==7){
	        			$("#tabs1").append("<s:hasPermission name="type:7"><li><input type='hidden' name='ss' value='"+item.id+"' /><a data-toggle='tab' aria-expanded='true' onclick='tabs(this)' >"+item.valueName+"</a></li></s:hasPermission>");
	        		}else if(item.id==8){
	        			$("#tabs1").append("<s:hasPermission name="type:8"><li><input type='hidden' name='ss' value='"+item.id+"' /><a data-toggle='tab' aria-expanded='true' onclick='tabs(this)' >"+item.valueName+"</a></li></s:hasPermission>");
	        		}
	        	});
	        	 $("#tabs1 li").eq(0).attr("class","active");
	        	 $("#commontype").val($("#tabs1 li").eq(0).find("input").val());
	        }  
	    });  
	});
	function tabs(obj){
		 $("#tabs1 li").removeAttr("class");
		 $(obj).parent("li").attr("class","active");
		 var type= $(obj).prev().val();
		 $("#commontype").val(type);
		var devicetype = $("#devicetype").val();
        $("#table_list").jqGrid('setGridParam', {
            postData: {'type': type,'level':devicetype}, //发送数据
            page: 1
        }).trigger("reloadGrid"); //重新载入
	}
</script>